<script setup>
import { ref } from "vue";
import MyChild from "./MyChild.vue";
let car = ref('奔驰')
let toy = ref('')
function getToy(value){
  toy.value = value
}
</script>
<template>
  <div class="myfather">
    父组件
    <p>车的品牌：{{ car }}</p>
    <h3 v-if="toy">父组件使用props接收子组件传递过来的数据,子组件的玩具是:{{toy}}</h3>
    <MyChild :car="car" :setToy="getToy"/>
  </div>
</template>
<style scoped>
.myfather {
  background-color: #d34646;
  padding: 10px;
  border: 1px solid #000;
}
</style>